var app = getApp()
var Ajax = require("../../utils/ajax.js")
Page({
  data: {
    
  },
  onLoad() {
    this.setData({
      nickname: app.globalData.activemember["grant.nickname"]
    })
  },
  bindfocus: function (e) {

  },
  bindblur: function (e) {
    this.setData({
      nickname: this.data.nickname
    })
  },
  saveinput: function (e) {
    this.setData({
      nickname: e.detail.value
    })
  },
  rename:function(e){
    Ajax.AsyncPost('/grant/rename_granted_member/', {
      B_id: app.globalData.activemember.B_id,
      nickname: this.data.nickname
    }, (data) => {
      app.globalData.activemember["grant.nickname"] = this.data.nickname;
      wx.navigateBack();
    })
  }
})